Using EOF flag to change multimedia block parameters
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi, I am wondering if it is possible to use the EOF flag on Simulink's 'From Multimedia File' block to trigger block parameter changes. What I am trying to do is this: When the multimedia file is done playing, the model will stop, change file (based on previous user input in the GUI), and restart the model. Basically an audio playlist that will automatically cycle through tracks.
I'm not quite sure how to do this though, since it needs to happen automatically at EOF, and isn't a callback.
Here's what I've done so far:
1. User specifies file to be added to queue.
2. File name and path are stored in separate arrays.
3. Added a series of checks to determine whether or not the model was stopped because of EOF or because of user choice.
4. Wrote code to perform various checks/change audio track/start model.
At this point, my model runs, I can add files to the queue, but at the end of the current file, the model just stops and doesn't change file. My code for changing tracks should work, I'm just not sure where to put it in the GUI code such that the file will change and interact with EOF.
0 Kommentare
Antworten (1)
Jarrod Rivituso
am 30 Apr. 2011
Could you put the logic to switch files and restart the simulation in MATLAB instead?
You could redefine the file using set_param. Something like
set_param('myModel/From Multimedia File','inputFilename','speech_dft.avi')
And then you could restart the simulation
sim('myModel')
I'm not sure about setting parameter values from the file based on EOF. However, if you really wanted to go that route, I would look into the Assertion block in the Simulink -> Model Verification library. It provides a callback mechanism based on an input signal. You could potentially reset a file from there.
2 Kommentare
Kaustubha Govind
am 2 Mai 2011
The model callback StopFcn is executed at the end of simulation, so you could potentially leverage that. However, that would be a very convoluted way of doing things, and potentially error prone.
How are you running the simulation exactly? Do you use the "sim" command in your GUI code? The "sim" command only returns after the model stops running, so you should then be able to check for new tracks and rerun simulation.
Siehe auch
Kategorien
Mehr zu Audio Processing Algorithm Design finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!